package com.antwork.common.web.jsp;

import java.io.InputStream;
import java.util.Properties;
import javax.servlet.jsp.tagext.BodyTagSupport;

public abstract class AbstractTag extends BodyTagSupport {
	private static final long serialVersionUID = 2510973616017293360L;

	protected Properties loadConfig(String name) throws Exception {
		String configName = "/page-" + name + ".properties";
		Properties prop = new Properties();
		try {
			InputStream is = TabConfig.class.getResourceAsStream(configName);
			
			prop.load(is);
			return prop;
		} catch (Throwable e) {
			throw new RuntimeException("config file cannot be load: "
					+ configName);
		}
	}

	protected char getNextSeperator(String uri) {
		if (uri.indexOf("?") != -1) {
			return '&';
		}
		return '?';
	}
}